var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, o) {
        e.__proto__ = o;
    } || function(e, o) {
        for (var t in o) o.hasOwnProperty(t) && (e[t] = o[t]);
    })(e, t);
}, function(e, t) {
    function c() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (c.prototype = t.prototype, 
    new c());
}), a = this && this.__decorate || function(e, o, t, c) {
    var s, l = arguments.length, n = l < 3 ? o : null === c ? c = Object.getOwnPropertyDescriptor(o, t) : c;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, o, t, c); else for (var a = e.length - 1; 0 <= a; a--) (s = e[a]) && (n = (l < 3 ? s(n) : 3 < l ? s(o, t, n) : s(o, t)) || n);
    return 3 < l && n && Object.defineProperty(o, t, n), n;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameConfig"), s = e("GameData"), c = e("AudioManager"), l = e("DataManager"), d = e("WebManager"), u = e("Global"), p = e("PrefabView"), h = cc._decorator, f = h.ccclass, g = h.property, m = function(o) {
    function e() {
        var e = null !== o && o.apply(this, arguments) || this;
        return e.tag = "follow", e.idx = 16, e.target = null, e;
    }
    return i(e, o), e.prototype.onClick = function() {
        var o = this;
        c.default.getInstance().playAudio("按钮2"), GA.Info.underCheck && r.GC.isDebug ? (this.target.emit("follow_success"), 
        this.hidePnl()) : "desktop" == this.tag ? GA.isPlatform(GA.Platform.ByteDance) && GA.PA && GA.PA.addShortcut({
            success: function(e) {
                console.log("addShortcut success", e), GA.PA.checkShortcut({
                    success: function(e) {
                        console.log("checkShortcut success", e), u.G.isExist = e.status.exist, u.G.isExist && (d.default.getInstance().sentLog("添加有礼成功"), 
                        o.target.emit("addShortcut_success"), o.hidePnl(), s.GD.isAddToDesktop = 1, l.default.getInstance().save());
                    },
                    fail: function(e) {
                        console.log("checkShortcut fail", e);
                    }
                });
            },
            fail: function(e) {
                console.log("addShortcut fail", e);
            }
        }) : "follow" == this.tag && this.openAwemeUserProfile({
            success: function() {
                o.checkFollowAwemeState({
                    success: function() {
                        u.G.isFollow && (d.default.getInstance().sentLog("关注有礼成功"), o.target.emit("follow_success"), 
                        o.hidePnl(), s.GD.isFollow = 1, l.default.getInstance().save());
                    }
                });
            }
        });
    }, e.prototype.checkFollowAwemeState = function(o) {
        GA.isPlatform(GA.Platform.ByteDance) ? GA.PA && GA.PA.checkFollowAwemeState({
            success: function(e) {
                console.log("checkFollowAwemeState success", e), e.hasFollowed ? u.G.isFollow = !0 : u.G.isFollow = !1, 
                o.success && o.success(e);
            },
            fail: function(e) {
                console.log("checkFollowAwemeState fail", e);
            }
        }) : GA.isPlatform(GA.Platform.Kwaigame) && ks && ks.checkFollowState({
            accountType: "CPServiceAccount",
            callback: function(e) {
                1 == e.errorCode ? (console.log("checkFollowState success", e), e.hasFollow ? u.G.isFollow = !0 : u.G.isFollow = !1, 
                o.success && o.success(e)) : console.log("checkFollowState fail", e);
            }
        });
    }, e.prototype.openAwemeUserProfile = function(o) {
        GA.isPlatform(GA.Platform.ByteDance) ? GA.PA && GA.PA.openAwemeUserProfile({
            success: function(e) {
                console.log("openAwemeUserProfile success", e), o.success && o.success(e);
            },
            fail: function(e) {
                console.log("openAwemeUserProfile fail", e);
            }
        }) : GA.isPlatform(GA.Platform.Kwaigame) && ks && ks.openUserProfile({
            accountType: "CPServiceAccount",
            callback: function(e) {
                1 == e.errorCode ? (console.log("openUserProfile success", e), o.success && o.success(e)) : console.log("openUserProfile fail", e);
            }
        });
    }, e.prototype.start = function() {}, a([ g ], e.prototype, "tag", void 0), a([ g ], e.prototype, "idx", void 0), 
    a([ f ], e);
}(p.default);

n.default = m;